// JointOwnFunction.cpp: implementation of the JointOwnFunction class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "phsshare.h"
#include "JointOwnFunction.h"
#include "SimpleExpression.h"
#include "ModelObject.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

using namespace PropertySystem;

IMPLEMENT_DYNAMIC_EX(JointOwnFunction, FunctionObject);

JointOwnFunction::JointOwnFunction()
{

}

JointOwnFunction::~JointOwnFunction()
{

}

CString JointOwnFunction::CaculateString(const CString& strExpr)
{
	ASSERT(!strExpr.IsEmpty());
	
	ASSERT(GetOwner());
	
	SimpleExpression expr(strExpr, GetOwner()->GetPropertyStack());
	Variable var = expr.Caculate();

	return (CString)var;
}

CString JointOwnFunction::CaculateString(const CString& strExpr,
										 PropertySystem::PropertyStack* pStack)
{
	ASSERT(!strExpr.IsEmpty());
	ASSERT(pStack);
		
	SimpleExpression expr(strExpr, pStack);
	Variable var = expr.Caculate();

	return (CString)var;
}